package com.scedu.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

//@Controller为了让springIOC容器初始化时自动扫描到
@Controller
public class HelloController  {
    //真实访问地址：项目名/hellocontroller/hello
    // @RequestMapping是为了映射请求路径，这里因为类与方法上都有映射所以访问时应该是
    ///hellocontroller/hello
    @RequestMapping("/hello")
    public  String hello(Model model){

        //向模型中添加属性msg的值，可以在jsp页面中取出来并渲染
        String result="返回的结果";
        model.addAttribute("msg",result);


        //web-inf/jsp/hello.jsp
        return "hello";
    }

}
